package model;

import java.util.ArrayList;

public class QueryAdjacencyList {
	public ArrayList<QueryEdge> list = new ArrayList<QueryEdge>();

	public void add(QueryEdge e) {
		for (int j = list.size() - 1; j >= 0; j--) {
			if (e.getTargetId() > list.get(j).getTargetId()) {
				this.list.add(j + 1, e);
				return;
			}
		}
		this.list.add(0, e);
		return;
	}

	public void add2(QueryEdge e) {
		for (int j = list.size() - 1; j >= 0; j--) {
			if (e.getSourceId() > list.get(j).getSourceId()) {
				this.list.add(j + 1, e);
				return;
			}
		}
		this.list.add(0, e);
		return;
	}

	public int size() {
		return list.size();
	}

	public QueryEdge get(int i) {
		return list.get(i);
	}
}
